package com.jetinno.utils;

import android.text.TextUtils;

/**
 * Created by zhangyuncai on 2021/11/16.
 */
public class CanisterIds {
    public static final int CANISTER_COFFEE_AA = 0XAA;//咖啡 170
    public static final int CANISTER_COFFEE_BB = 0XBB;//咖啡2 187
    public static final int CANISTER_WATER_0 = 0;//热水
    public static final int CANISTER_INSTANT_1 = 1;//常规料盒(含茶叶)
    public static final int CANISTER_INSTANT_2 = 2;//常规料盒(含茶叶)
    public static final int CANISTER_INSTANT_3 = 3;//常规料盒(含茶叶)
    public static final int CANISTER_INSTANT_4 = 4;//常规料盒(含茶叶)
    public static final int CANISTER_INSTANT_5 = 5;//常规料盒(含茶叶)
    public static final int CANISTER_INSTANT_6 = 6;//常规料盒(含茶叶)
    public static final int CANISTER_INSTANT_7 = 7;//常规料盒(含茶叶)
    public static final int CANISTER_INSTANT_8 = 8;//常规料盒(含茶叶)
    public static final int CANISTER_PUREE_241 = 0xF1;//果浆1 241 BIB
    public static final int CANISTER_PUREE_242 = 0xF2;//果浆2 242 BIB
    public static final int CANISTER_PUREE_243 = 0xF3;//果浆3 243 BIB
    public static final int CANISTER_PUREE_244 = 0xF4;//果浆4 244 BIB
    public static final int CANISTER_PUREE_245 = 0xF5;//果浆5 245 BIB
    public static final int CANISTER_PUREE_246 = 0xF6;//果浆6 246 BIB
    public static final int CANISTER_PUREE_247 = 0xF7;//果浆7 247 BIB
    public static final int CANISTER_PUREE_248 = 0xF8;//果浆8 248 BIB
    public static final int CANISTER_ICE_224 = 0xE0;//出冰 224
    public static final int CANISTER_SYRUP_177 = 0xB1;//糖浆1 177
    public static final int CANISTER_SYRUP_178 = 0xB2;//糖浆2 178
    public static final int CANISTER_SYRUP_179 = 0xB3;//糖浆3 179
    public static final int CANISTER_SYRUP_180 = 0xB4;//糖浆4 180
    public static final int CANISTER_SYRUP_181 = 0xB5;//糖浆5 181
    public static final int CANISTER_SYRUP_182 = 0xB6;//糖浆6 182
    public static final int CANISTER_D0 = 0xD0;//泡面 208
    public static final int CANISTER_D1 = 0xD1;//零食 209
    public static final int CANISTER_HOT_MILK_E1 = 0xE1;//热奶 225
    public static final int CANISTER_HOT_MILK_FOAM_E2 = 0xE2;//热奶泡 226
    public static final int CANISTER_COLD_MILK_E3 = 0xE3;//冷奶 227
    public static final int CANISTER_COLD_MILK_FOAM_E4 = 0xE4;//冷奶泡 228 （注冷热水选择=1 表示脱脂奶）
    public static final int CANISTER_MILK_BOX_9991 = 9991;//奶盒1
    public static final int CANISTER_MILK_BOX_9992 = 9992;//奶盒2
    public static final int CANISTER_MILK_BOX_9993 = 9993;//奶盒3
    public static final int CANISTER_MILK_BOX_9994 = 9994;//奶盒4
    public static final int CANISTER_MILK_BOX_9995 = 9995;//奶盒5
    public static final int CANISTER_MILK_BOX_9996 = 9996;//奶盒6
    public static final int CANISTER_MILK_BOX_9997 = 9997;//奶盒7
    public static final int CANISTER_MILK_BOX_9998 = 9998;//奶盒8
    public static final int CANISTER_STEAM_E8 = 0xE8;//蒸汽 232
    public static final int CANISTER_COLD_COFFEE_EE = 0xEE;//冷咖啡 238


    //显示料盒的顺序，包括了所有的料盒 按照 咖啡,速溶,冰,糖浆,奶,冷咖啡,蒸汽排序
    public static final int[] canisterOrders = new int[]{
            CANISTER_COFFEE_AA,
            CANISTER_COFFEE_BB,
            CANISTER_WATER_0,
            CANISTER_INSTANT_1,
            CANISTER_INSTANT_2,
            CANISTER_INSTANT_3,
            CANISTER_INSTANT_4,
            CANISTER_INSTANT_5,
            CANISTER_INSTANT_6,
            CANISTER_INSTANT_7,
            CANISTER_INSTANT_8,
            CANISTER_PUREE_241,
            CANISTER_PUREE_242,
            CANISTER_PUREE_243,
            CANISTER_PUREE_244,
            CANISTER_PUREE_245,
            CANISTER_PUREE_246,
            CANISTER_PUREE_247,
            CANISTER_PUREE_248,
            CANISTER_ICE_224,
            CANISTER_SYRUP_177,
            CANISTER_SYRUP_178,
            CANISTER_SYRUP_179,
            CANISTER_SYRUP_180,
            CANISTER_SYRUP_181,
            CANISTER_SYRUP_182,
            CANISTER_D0,
            CANISTER_D1,
            CANISTER_HOT_MILK_E1,
            CANISTER_HOT_MILK_FOAM_E2,
            CANISTER_COLD_MILK_E3,
            CANISTER_COLD_MILK_FOAM_E4,
            CANISTER_MILK_BOX_9991,
            CANISTER_MILK_BOX_9992,
            CANISTER_MILK_BOX_9993,
            CANISTER_MILK_BOX_9994,
            CANISTER_MILK_BOX_9995,
            CANISTER_MILK_BOX_9996,
            CANISTER_MILK_BOX_9997,
            CANISTER_MILK_BOX_9998,
            CANISTER_STEAM_E8,
    };


    /**
     * 咖啡豆料盒
     *
     * @param canisterId
     * @return
     */
    public static boolean isCoffee(int canisterId) {
        return canisterId == CANISTER_COFFEE_AA || canisterId == CANISTER_COFFEE_BB;
    }

    /**
     * 是否含有咖啡
     *
     * @param canisterIds
     * @return
     */
    public static boolean hasCoffee(String canisterIds) {
        if (!TextUtils.isEmpty(canisterIds)) {
            String[] canisterIdArray = canisterIds.split(",");
            if (canisterIdArray != null && canisterIdArray.length > 0) {
                for (String canisterIdStr : canisterIdArray) {
                    if (isCoffee(NumberUtil.parseInteger(canisterIdStr))) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    /**
     * 料盒ID集合是否含有指定的料盒ID
     *
     * @param canisterIds
     * @return
     */
    public static boolean hasCanisterId(String canisterIds, int canisterId) {
        if (!TextUtils.isEmpty(canisterIds)) {
            String[] canisterIdArray = canisterIds.split(",");
            if (canisterIdArray != null && canisterIdArray.length > 0) {
                for (String canisterIdStr : canisterIdArray) {
                    if (NumberUtil.parseInteger(canisterIdStr) == canisterId) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    /**
     * 热水料盒
     *
     * @param canisterId
     * @return
     */
    public static boolean isWater(int canisterId) {
        return canisterId == CANISTER_WATER_0;
    }

    /**
     * 制冰机
     *
     * @param canisterId
     * @return
     */
    public static boolean isIce(int canisterId) {
        return canisterId == CANISTER_ICE_224;
    }

    /**
     * 是否是奶盒
     *
     * @param canisterId
     * @return
     */
    public static boolean isMilkBox(int canisterId) {
        return canisterId >= 9991 && canisterId <= 9998;
    }

    /**
     * 是否是鲜奶,冷奶
     *
     * @param canisterId
     * @return
     */
    public static boolean isMilkType(int canisterId) {
        return canisterId == CANISTER_HOT_MILK_E1 ||
                canisterId == CANISTER_HOT_MILK_FOAM_E2 ||
                canisterId == CANISTER_COLD_MILK_E3 ||
                canisterId == CANISTER_COLD_MILK_FOAM_E4;
    }

    /**
     * 冷咖啡
     *
     * @param canisterId
     * @return
     */
    public static boolean isColdCoffee(int canisterId) {
        return canisterId == CANISTER_COLD_COFFEE_EE;
    }

    /**
     * 蒸汽
     *
     * @param canisterId
     * @return
     */
    public static boolean isSteamCoffee(int canisterId) {
        return canisterId == CANISTER_STEAM_E8;
    }

    /**
     * 热奶
     *
     * @param canisterId
     * @return
     */
    public static boolean isHotMilk(int canisterId) {
        return canisterId == CANISTER_HOT_MILK_E1;
    }

    /**
     * 热奶泡
     *
     * @param canisterId
     * @return
     */
    public static boolean isHotMilkForm(int canisterId) {
        return canisterId == CANISTER_HOT_MILK_FOAM_E2;
    }

    /**
     * 冷奶
     *
     * @param canisterId
     * @return
     */
    public static boolean isColdMilk(int canisterId) {
        return canisterId == CANISTER_COLD_MILK_E3;
    }

    /**
     * 冷奶泡
     *
     * @param canisterId
     * @return
     */
    public static boolean isColdMilkForm(int canisterId) {
        return canisterId == CANISTER_COLD_MILK_FOAM_E4;
    }

    /**
     * 速溶料盒
     *
     * @param canisterId
     * @return
     */
    public static boolean isInstant(int canisterId) {
        return canisterId >= 1 && canisterId <= 8;
    }

    /**
     * 常规料盒
     *
     * @param canisterId
     * @return
     */
    public static boolean isInstantAndWater(int canisterId) {
        return canisterId >= 0 && canisterId <= 8;
    }

    /**
     * 果浆料盒
     *
     * @param canisterId
     * @return
     */
    public static boolean isPureeCanister(int canisterId) {
        return canisterId >= 241 && canisterId <= 248;
    }

    /**
     * 糖浆料盒
     *
     * @param canisterId
     * @return
     */
    public static boolean isSyrupCanister(int canisterId) {
        return canisterId >= 177 && canisterId <= 182;
    }

}
